export default {
    data() {
        user: { }
    },
    methods: {
        async getUserObject() { // 请求用户
            await this.$http({
                url: this.$http.adornUrl("/info"),
                method: "get"
            }).then((res) => {
                this.user = res.data.data;
                localStorage.setItem('user', JSON.stringify(res.data.data))
                return this.user
            }).catch((err) => {
                console.log(err);
            })

        },
        async getUser() { //
            // 获取到当前操作用户
            this.user = JSON.parse(window.localStorage.getItem('user'));
            if (!this.user) {
                return await this.getUserObject();
            }
        }
    }
}